Post

Replies

Boosts

Views

Activity

Reply to How to: Previews in Swift Package?
Try to remove default TestPackagePreview struct that was added by Xcode in TestPackagePreview target. Looks like Xcode 12 somehow makes an alias to this struct when it builds preview which leads to a circular dependency. This is the error I had under "Diagnostics" button ("MyLibrary" is the name of the package and also the name of this default struct): .../Build/Intermediates.noindex/Previews/MyLibrary/Intermediates.noindex/MyLibrary.build/Debug-iphonesimulator/MyLibrary.build/Objects-normal/x86_64/MyLibrary.2.preview-thunk.swift:13:11: error: circular reference typealias MyLibrary = MyLibrary.MyLibrary           ^ Hope this helps.
Jun ’20
Reply to SwiftUI bottom-first List (inverted)
I think this is more complicated than just using reversed data. In chat you want to keep offset from the bottom. So when user opens a chat the last (the most recent one) message should be visible, basically bottom content offset is 0. Then, when the chat loads more history, it should keep the current bottom offset. Unfortunately, SwiftUI implementation inserts items from the top and keeps top offset, as it was already mentioned. Also, there is no direct control of scrollview offset in SwiftUI. You could try to use ScrollViewReader for initial loading but not for future history loads because the API is very limited. Flipping the list and then all the items inside back seems like the most suitable solution but it opens a lot of issues (navbar jumping, pull to refresh, scroll indicator direction) and adds extra complexity for the code. Described chat use case seems quite common, I'd vote for an extra special modifier as well.
Jun ’21